<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
import="Entity.*"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">  <!-- 以上代码告诉IE浏览器，IE8/9及以后的版本都会以最高版本IE来渲染页面。 -->  
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>机房管理</title>
	<link rel="stylesheet" href="http://localhost:8080/OpenExperimentManagementSystem/css/normalize.css">
	<link rel="stylesheet" href="http://localhost:8080/OpenExperimentManagementSystem/css/common.css">
	<link rel="stylesheet" type="text/css" href="http://localhost:8080/OpenExperimentManagementSystem/css/room_operate.css">
	

  </head>
  
   <script type="text/javascript" >  
 
  
 
	  
	  function delConfirm(){
	    if(confirm("确定删除吗？")){
	      return true;
	    }
	    else{
	      return false;
	    }
	  
	  }
	  
	</script>
  <%
  //取得所传值
  	String mid=(String)request.getAttribute("mid");
  	String mname=(String)request.getAttribute("mname");
  	String week=(String)request.getAttribute("week");
  	String day=(String)request.getAttribute("day");
  	String section=(String)request.getAttribute("section");
  	//String []kep={"第一大节","第二大节","第三大节","第四大节"};
  	String []kept={"周一","周二","周三","周四","周五","周六","周日"};
  	String []kept1={"第一大节","第二大节","第三大节","第四大节"};
  	
  	List<RoomHelp>list=null;
  	list=(List<RoomHelp>)request.getAttribute("list");
  	int len=0;
  	if(list!=null) len=list.size();

   if(list==null) {%>
  	  <jsp:forward page="/servlet/CheckRoomServlet">
  	  	<jsp:param name="mid" value="<%=mid %>" />
     	<jsp:param name="mname" value="<%=mname %>" />
  	  </jsp:forward> 
  	
  <% }%>
  
  
  <body style="background:url(images/back6.jpg);background-size:100% 100% ; background-attachment: fixed"
  style="padding:20px;">
	<header>
		<div class="logo">
		<a href="http://cs.njust.edu.cn/">
			<img src="http://localhost:8080/OpenExperimentManagementSystem/images/cslogo.png" style="width: 80px;height: 80px;margin-left: 250px;margin-top: 20px;" >
		</a>
			<h1 class="vertical-center">开放性实验辅助管理系统</h1>
		</div>
		<div class="logoff">
			<a href="#"><span><em class="username"><%=mname%></em>（<em class="usernum"><%=mid %></em>）</span></a>
			<a href="servlet/CheckRoomServlet?op=quit" id="logout"><img src="http://localhost:8080/OpenExperimentManagementSystem/images/out.png" alt="注销登录"></a>
		</div>
	</header><!-- header结束 -->
	
	<div class="container" style="margin:20px auto;">
		<nav class="nav-list">
			<a href="servlet/ManagerPageServlet?mid=<%=mid %>&mname=<%=mname %>" class="nav-item" id="nav-item1">
				<span class="iconfont">&#xe63e;</span>
				<span class="item-info">主页</span>
			</a>
			<a href="servlet/CheckMessageServlet?mid=<%=mid %>&mname=<%=mname %>" class="nav-item" id="nav-item2"><!-- 暂无 -->
				<span class="item-info">实验平台交流</span>
			</a>
			<a href="servlet/CheckExpServlet?mid=<%=mid%>&mname=<%=mname%>" class="nav-item" id="nav-item3">
				<span class="item-info">实验管理</span>
			</a>
			<a href="servlet/CheckExpServlet?op=ret&mid=<%=mid%>&mname=<%=mname%>" class="nav-item" id="nav-item4">
				<span class="item-info">机房管理</span>
			</a>
			<a href="servlet/CheckTimetableServlet?mid=<%=mid%>&mname=<%=mname%>" class="nav-item" id="nav-item4">
				<span class="item-info">课表管理</span>
			</a>
			<span class="triangle" style="left: 629px;"></span>
		</nav>
		<!--  -->
	<form action="servlet/CheckRoomServlet" method="get">
  		<input type="hidden" name="op" value="query">
  		<select name="week">
  			<% if(week!=null&&week!=null){ %>
   			<option value=<%=week %>><%="第"+week+"周" %></option>
   			<% } %>
  			<%
  			for(int i=1;i<=22;i++){
  			 %>
  			 	 <option value=<%=i %>><%="第"+i+"周" %></option>
  			 <%
  			 }
  			  %>
  		</select>
  		
  		<!-- 这个周次如何模仿，如何确定当前周次 -->
   		<select name="day">
   			<% if(day!=null&&day!=null){ %>
   			<option value=<%=day %>><%=kept[Integer.parseInt(day)-1] %></option>
   			<% } %>
   			<option value="1">周一</option>
   			<option value="2">周二</option>
   			<option value="3">周三</option>
   			<option value="4">周四</option>
   			<option value="5">周五</option>
   			<option value="6">周六</option>
   			<option value="7">周日</option>
   		</select>
   		<!-- <input type="text" name="day" > -->
   		<select name="section">
   			<% if(section!=null&&section!=null){ %>
   			<option value=<%=section %>><%=kept1[Integer.parseInt(section)-1] %></option>
   			<% } %>
   			<option value="1">第一大节</option>
   			<option value="2">第二大节</option>
   			<option value="3">第三大节</option>
   			<option value="4">第四大节</option>
   		</select>
   		
   		<input type="hidden" name="mid" value=<%=mid%>>
   		<input type="hidden" name="mname" value=<%=mname%>>
   		<input type="submit" value="查询">
   		<button><a href="servlet/CheckRoomServlet?op=all"></a>全部</button>
   		<!-- 跳转到CheckExp.jsp页面，传递自己的身份id -->		
   		
   </form>
   
		<div class="content">
			<div class="M00" style="min-height: 400px; _height: 400px;">
			    <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e1e1e1" class="List_T">
			        <tr>
			            <td align="center" bgcolor="#b8b8b8">
			                <strong>机房号</strong>
			            </td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>类型</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>总数</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>剩余数</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <a href="servlet/CheckRoomServlet?op=add1&mid=<%=mid%>&mname=<%=mname%>>">添加</a>
			        	</td>
			        </tr>
			   <%
			   if(list!=null){
			   		for(int i=0;i<list.size();i++){
			   		RoomHelp t=list.get(i);
			   		if(t!=null){
			    %>
			        <tr>
			            <td align="center" bgcolor="#FFFFFF">
							<%=t.getRoomid() %>
			            </td>
			            <%
			    		String type=null;
			    		if(t.getRoomtype()==1) type="硬件教室";
			    		else type="软件教室";
			    		 %>
			            <td align="center" bgcolor="#FFFFFF">
							<%=type %>
			            </td>
			            <td align="center" bgcolor="#FFFFFF">
			                <%=t.getTotal() %>
			            </td>
			            <td align="center" bgcolor="#FFFFFF">
			                <%=t.getLeftSum() %>
			            </td>
			            <td align="center" bgcolor="#FFFFFF">
			                <a href="servlet/CheckRoomServlet?op=del&roomid=<%=t.getRoomid()%>&mid=<%=mid%>&mname=<%=mname%>" onclick="return delConfirm()">删除</a>
			            </td>
			        </tr>
			       <%  }}} %>
				</table>
			</div>
			
		</div>
	</div>
	
</body>
   
   
 
</html>
